home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!gate.demon.co.uk
- From: Justin Lane <justin@redalert.demon.co.uk>
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Help with parallel port programming...
- Date: Thu, 28 Mar 96 00:35:00 GMT
- Organization: Private Node
- Message-ID: <9603280035.AA000cs@redalert.demon.co.uk>
- References: <4ihu64$1s5@kira.cc.uakron.edu> <31513E38.7885@fs1.ee.man.ac.uk> <4j9sfh$11k0@baggins.cc.flinders.edu.au>
- X-NNTP-Posting-Host: gate.demon.co.uk
- X-Newsreader: TIN [AMIGA 1.3 950726BETA PL0]
- X-Mail2News-Path: relay-1.mail.demon.net!gate.demon.co.uk
-
- Daniel J. O'Connor (doconnor@sybil.ist.flinders.edu.au) wrote:
- : Christos Dimitrakakis (mbge4cd1@fs1.ee.man.ac.uk) wrote:
- :
- : : You have to configure the parallel port for output before writing
- : : and for input before reading, otherwise it will not work.
- : : You can set it for input by :
- : : First put the address at a register
- : : LEA $bfe101,a1
- : : set for input:
- : : MOVE.b (a1),0
- : : set for output
- : : MOVE.b (a1),255
- :
- : You should ALSO allocate the parallel port resource before playing
- : with it, otherwise someones print jobs will stomp all over you...
- : I have some code in C as well which does all this stuff :) There is
- : also some on aminet you might want to look at...
- :
- : Seeya
- : Darius
- : ~~~~~~
- It is probably a good idea to allocate the resource if your code is going to
- run with the OS but there is no need to bother if you kill the OS off.
- BTW the assembler example looks a bit 8086'ish ie. destination, source
- operands. The example move.b is moving from the contents of the memory
- address pointed at by register a1 to memory location 0 and 255.
- The CIA locations appear to be wrong.
-
- move.b #%11110000,$bfe301 ; bits 7-4 = output and bits 3-0 = input (DDRB)
- move.b $bfe101,D0 ; read contents of parallel port (PRB) regardless of state
- ; of the Data Direction Register for port B $bfe301
- move.b D0,$bfe101 ; write contents of d0 to parallel port (PRB) only bits
- ; set for output will be set
-